﻿using System;
using System.Linq;
using ZBJF.Warranty.Common.Enums.InsuranceProducts;
using ZBJF.Warranty.Model;
using ZBJF.Warranty.Model.ViewModel.BaseQueryModel;
using ZBJF.Warranty.Model.ViewModel.InsuranceProducts;

namespace ZBJF.Warranty.IBLL
{
    public partial interface IInsuranceProductOrderCardService
    {
        InsuranceProductOrderCard LoadById(int id);
        IQueryable<InsuranceProductOrderCard> Load(string cardNo, string password);
        /// <summary>
        /// 获取保险卡销售订单卡号密码列表
        /// </summary>
        /// <param name="insuranceProductOrderId"></param>
        /// <returns></returns>
        IQueryable<InsuranceProductOrderCard> LoadByInsuranceProductOrderId(int insuranceProductOrderId);
        IQueryable<InsuranceProductOrderCard> GetPagingList(InsuranceProductOrderCardModel model, out int total);

        /// <summary>
        /// 创建多个卡密
        /// </summary>
        /// <param name="cardCount"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        bool CreateCard(int cardCount, InsuranceProductOrderCard model);

        /// <summary>
        /// 验证卡号密码
        /// </summary>
        /// <param name="insuranceProductId">使用哪个产品（不同基础产品可能卡号密码一样）</param>
        /// <param name="cardNo">卡号</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        bool ValidateCardPassword(long insuranceProductId, string cardNo, string password);

        /// <summary>
        /// 使用卡号密码，更新状态
        /// </summary>
        /// <param name="insuranceProductId">激活哪个产品（不同基础产品可能卡号密码一样）</param>
        /// <param name="cardNo"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        bool UseCard(long insuranceProductId, string cardNo, string password);

        /// <summary>
        /// 获取产品某一状态的数量（已销售（待激活），已激活，已过期） 销量能统计出基础产品的数量，而销售额不能
        /// </summary>
        /// <param name="sellerInsuranceProductId">商户产品ID</param>
        /// <param name="insuranceProductId">基础产品ID</param>
        /// <param name="status">状态</param>
        /// <param name="employeeId">销售员，不传不过滤销售员</param>
        /// <returns></returns>
        int GetInsuranceCardCount(long sellerInsuranceProductId, long insuranceProductId, long employeeId = 0, InsuranceProductOrderCardStatus status = 0);
        /// <summary>
        /// 获取商家产品某一状态的数量（已销售（待激活），已激活，已过期） 销量能统计出商家产品的数量，而销售额不能
        /// </summary>
        /// <param name="sellerInsuranceProductId">商户产品ID</param>
        /// <param name="status">状态</param>
        /// <returns></returns>
        int GetSellerInsuranceCardCount(long sellerInsuranceProductId, InsuranceProductOrderCardStatus status = 0);
        /// <summary>
        /// 获得某一月份的产品销量
        /// </summary>
        /// <param name="dtMonth">格式"yyyyMM"</param>
        /// <param name="sellerInsuranceProductId"></param>
        /// <param name="insuranceProductId"></param>
        /// <param name="status"></param>
        /// <param name="employeeId"></param>
        /// <returns></returns>
        int GetInsuranceCardSaleCount(string dtMonth, long employeeId, long sellerInsuranceProductId = 0, long insuranceProductId = 0, InsuranceProductOrderCardStatus status = 0);


    }
}